Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jwt-cpp: fix building without picojson #12735

Merged
merged 7 commits into from
Sep 14, 2022

Conversation

JorgenPo
Copy link
Contributor

@JorgenPo JorgenPo commented Aug 31, 2022

Specify library name and version: jwt-cpp/0.6.0

Fix compilation of jwt-cpp without picojson library
Fixes #12706


  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the conan-center hook activated.

@CLAassistant
Copy link

CLAassistant commented Aug 31, 2022

CLA assistant check
All committers have signed the CLA.

@conan-center-bot

This comment has been minimized.

@JorgenPo
Copy link
Contributor Author

@SpaceIm @prince-chrismc, not sure what to do with test_package, can you please clarify what is the right way to deal with it?

@prince-chrismc
Copy link
Contributor

Make sure to comment in #4 🙏

@prince-chrismc
Copy link
Contributor

prince-chrismc commented Sep 1, 2022

Add the header #include "jwt-cpp/traits/kazuho-picojson/defaults.h" to the test package please

@uilianries
Copy link
Member

@JorgenPo PLease, dont forget to sign the CLA pointed in this PR.

@JorgenPo JorgenPo mentioned this pull request Sep 1, 2022
@conan-center-bot

This comment has been minimized.

@JorgenPo
Copy link
Contributor Author

JorgenPo commented Sep 1, 2022

@prince-chrismc, done!
@uilianries, signed the CLA

JorgenPo and others added 2 commits September 1, 2022 22:19
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries
Copy link
Member

@JorgenPo Please, consider JorgenPo#1

It will prepare jwt-cpp recipe for Conan 2.0

@conan-center-bot

This comment has been minimized.

@JorgenPo
Copy link
Contributor Author

JorgenPo commented Sep 5, 2022

@uilianries, merged your PR

tools.patch(**patch)
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)
apply_conandata_patches(self)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
apply_conandata_patches(self)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied suggested change

basic_layout(self, src_folder="src")

def build(self):
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pass
apply_conandata_patches(self)

Doing a new try, it works when using no_copy_source

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -27,21 +27,26 @@ def export_sources(self):
def requirements(self):
self.requires("openssl/1.1.1q")
if not self._supports_generic_json:
self.requires("picojson/1.3.0")
self.requires("picojson/cci.20210117")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to point to official releases when they are available

Suggested change
self.requires("picojson/cci.20210117")
self.requires("picojson/cci.1.3.0")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -1,4 +1,5 @@
#include <jwt-cpp/jwt.h>
#include <jwt-cpp/traits/kazuho-picojson/defaults.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this only exists in 0.6.0 +

You'll need to drop older versions 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some additional definitions to the test package and placed picojson traits files to the test package folder to be able to compile older jwt-cpp versions.
Tested building on all versions listed in conandata.yml

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How am I supposed to use this package now? Why do you want me to copy-paste these files as well, instead of just changing _supports_generic_json to version >= 6.0. I see no reason why we want to define JWT_DISABLE_PICOJSON in the recipe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an example, the test package is more complicated because it's supporting many versions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use version 0.6.0 you can include any of the support JSON libraries and that file will already be present

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated 0.5.0 to new revision and it became not usable because of hard coded define :(
I had to upgrade to 0.6.0 and slightly adjust my code, now it is working. But I still think setting this define without option flag was a bad decision. It turns off part of the functionality of the library which I was using in the previous revision.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/Thalhammer/jwt-cpp/releases did add support for generic json at 0.5.0 but I agree this could be improved #12735 (review)

Feel free to open a PR to improve the recipe :)

@prince-chrismc
Copy link
Contributor

This PR is trying to do a lot 🙈 sorry everything is getting tossed in

@conan-center-bot

This comment has been minimized.

@JorgenPo
Copy link
Contributor Author

@prince-chrismc, @uilianries, fixed all review comments, could you have a look please?

@uilianries
Copy link
Member

@JorgenPo Waiting for the CI result ... It's taking more time usual. Your PR looks good now.

@conan-center-bot
Copy link
Collaborator

All green in build 5 (1ffa1868474750bbfbab7aea9ebdbfe2ec9c1ad1):

  • jwt-cpp/0.6.0@:
    All packages built successfully! (All logs)

    🔸 Informative: This recipe is not ready for Conan v2

    We have started the migration process to Conan v2 and exporting recipes successfully will be required in the future.
    This is just an informative note to gain awareness about the process, no need to take any action. The plan is to enforce smaller steps that are easier to fix and, eventually, this conan export step will work.
    See the recipe migration guide to know more about the changes required.

    WARN: Name containing special chars is discouraged 'jwt-cpp'
    jwt-cpp/0.6.0: Exporting package recipe
    jwt-cpp/0.6.0 exports: File 'conandata.yml' found. Exporting it...
    jwt-cpp/0.6.0: Copied 1 '.yml' file: conandata.yml
    jwt-cpp/0.6.0 exports: Copied 1 '.yml' file: conandata.yml
    jwt-cpp/0.6.0: Calling export_sources()
    ERROR: jwt-cpp/0.6.0: Error in export_sources() method, line 25
    	self.copy(patch["patch_file"])
    	AttributeError: 'JwtCppConan' object has no attribute 'copy'
    
  • jwt-cpp/0.5.0@:
    All packages built successfully! (All logs)

    🔸 Informative: This recipe is not ready for Conan v2

    We have started the migration process to Conan v2 and exporting recipes successfully will be required in the future.
    This is just an informative note to gain awareness about the process, no need to take any action. The plan is to enforce smaller steps that are easier to fix and, eventually, this conan export step will work.
    See the recipe migration guide to know more about the changes required.

    WARN: Name containing special chars is discouraged 'jwt-cpp'
    jwt-cpp/0.5.0: Exporting package recipe
    jwt-cpp/0.5.0 exports: File 'conandata.yml' found. Exporting it...
    jwt-cpp/0.5.0: Copied 1 '.yml' file: conandata.yml
    jwt-cpp/0.5.0 exports: Copied 1 '.yml' file: conandata.yml
    jwt-cpp/0.5.0: Calling export_sources()
    ERROR: jwt-cpp/0.5.0: Error in export_sources() method, line 25
    	self.copy(patch["patch_file"])
    	AttributeError: 'JwtCppConan' object has no attribute 'copy'
    
  • jwt-cpp/0.5.1@:
    All packages built successfully! (All logs)

    🔸 Informative: This recipe is not ready for Conan v2

    We have started the migration process to Conan v2 and exporting recipes successfully will be required in the future.
    This is just an informative note to gain awareness about the process, no need to take any action. The plan is to enforce smaller steps that are easier to fix and, eventually, this conan export step will work.
    See the recipe migration guide to know more about the changes required.

    WARN: Name containing special chars is discouraged 'jwt-cpp'
    jwt-cpp/0.5.1: Exporting package recipe
    jwt-cpp/0.5.1 exports: File 'conandata.yml' found. Exporting it...
    jwt-cpp/0.5.1: Copied 1 '.yml' file: conandata.yml
    jwt-cpp/0.5.1 exports: Copied 1 '.yml' file: conandata.yml
    jwt-cpp/0.5.1: Calling export_sources()
    ERROR: jwt-cpp/0.5.1: Error in export_sources() method, line 25
    	self.copy(patch["patch_file"])
    	AttributeError: 'JwtCppConan' object has no attribute 'copy'
    
  • jwt-cpp/0.4.0@:
    All packages built successfully! (All logs)

    🔸 Informative: This recipe is not ready for Conan v2

    We have started the migration process to Conan v2 and exporting recipes successfully will be required in the future.
    This is just an informative note to gain awareness about the process, no need to take any action. The plan is to enforce smaller steps that are easier to fix and, eventually, this conan export step will work.
    See the recipe migration guide to know more about the changes required.

    WARN: Name containing special chars is discouraged 'jwt-cpp'
    jwt-cpp/0.4.0: Exporting package recipe
    jwt-cpp/0.4.0 exports: File 'conandata.yml' found. Exporting it...
    jwt-cpp/0.4.0: Copied 1 '.yml' file: conandata.yml
    jwt-cpp/0.4.0 exports: Copied 1 '.yml' file: conandata.yml
    jwt-cpp/0.4.0: Calling export_sources()
    ERROR: jwt-cpp/0.4.0: Error in export_sources() method, line 25
    	self.copy(patch["patch_file"])
    	AttributeError: 'JwtCppConan' object has no attribute 'copy'
    
  • jwt-cpp/0.3.1@:
    All packages built successfully! (All logs)

    🔸 Informative: This recipe is not ready for Conan v2

    We have started the migration process to Conan v2 and exporting recipes successfully will be required in the future.
    This is just an informative note to gain awareness about the process, no need to take any action. The plan is to enforce smaller steps that are easier to fix and, eventually, this conan export step will work.
    See the recipe migration guide to know more about the changes required.

    WARN: Name containing special chars is discouraged 'jwt-cpp'
    jwt-cpp/0.3.1: Exporting package recipe
    jwt-cpp/0.3.1 exports: File 'conandata.yml' found. Exporting it...
    jwt-cpp/0.3.1: Copied 1 '.yml' file: conandata.yml
    jwt-cpp/0.3.1 exports: Copied 1 '.yml' file: conandata.yml
    jwt-cpp/0.3.1: Calling export_sources()
    ERROR: jwt-cpp/0.3.1: Error in export_sources() method, line 25
    	self.copy(patch["patch_file"])
    	AttributeError: 'JwtCppConan' object has no attribute 'copy'
    

Copy link
Contributor

@prince-chrismc prince-chrismc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not crazy for copy pasting files that exist but the solution is pretty complicated and we want this for 2.0

I'll circle back to work on it

@conan-center-bot conan-center-bot merged commit f8181c5 into conan-io:master Sep 14, 2022
@JorgenPo JorgenPo deleted the package/jwt-cpp branch September 16, 2022 08:34
ericLemanissier pushed a commit to ericLemanissier/conan-center-index that referenced this pull request Sep 26, 2022
* jwt-cpp: fix building without picojson

* jwt-cpp: add missing traits header to test package

* Adapt for Conan 2.0

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Fix building test_package for older jwt-cpp versions

* Conanfile review fixes

* Add endline to the end of files

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[package] jwt-cpp/0.6.0: Package doesn't compile because of missing picojson requirement
6 participants